1. Field of the Invention
The present invention relates to an electronic device and related method for detection of bus contention, and more particularly, to an electronic device of detecting contention of a bidirectional bus and related method.
2. Description of the Prior Art
A bus is a transmission interface capable of transmitting data between two electronic devices or among a plenty of electronic devices. In general, buses are classified with unidirectional and a bidirectional types. The unidirectional bus is allowed to transmit data from an X device to a Y device, but not from the Y device to the X device. The bidirectional bus is allowed to exchange data between the X and Y devices. In implementation of a chip, employment of the bidirectional bus interface has a need of fewer pins than employment of the unidirectional bus.
Please refer to FIG. 1, which is a schematic diagram of a master-slave system 10 according to the prior art. The master-slave system 10 employs a half-duplex bidirectional bus 12 for data transmission between a master device 14 and a slave device 16. The master device 14 includes a transmitter 142 and a receiver 144, whereas the slave device 16 includes a transmitter 162 and a receiver 164. In normal situation, the receiver 164 performs data receptions and no data is allowed to be transmitted from the transmitter 162 when the transmitter 142 outputs a data signal S1. Similarly, the receiver 144 performs data reception and no data is allowed to be transmitted by the transmitter 142 when the transmitter 162 outputs a data signal S2. That is, only one transmitting side is allowed to drive the bidirectional bus 12 at one time. As a result, the master device 14 and the slave device 16 have to contend for every transmission opportunity. However, the bidirectional bus 12 is likely to be simultaneously driven by the master device 14 and the slave device 16 due to occurrence of a signal transition during bus contention. This causes an operating failure in the bidirectional bus 12. For example, when the data signals S1 and S2 are simultaneously outputted to the bidirectional bus 12 as can be seen from FIG. 1, the transitions of the data signals S1 and S2 cause signal cancelling, thereby resulting in data reception failures in the receivers 164 and 144.